import Vue from 'vue'
import VueRouter from 'vue-router'

import layout from '@/views/Layout'
import login from '@/views/Login'
import NotFound from '@/views/404'
import home from '@/views/Layout/home'
import qa from '@/views/Layout/question'
import video from '@/views/Layout/video'
import user from '@/views/Layout/user'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home',
    component: layout,
    children: [
      {
        path: '/home',
        component: home
      },
      {
        path: '/qa',
        component: qa
      },
      {
        path: '/video',
        component: video
      },
      {
        path: '/user',
        component: user
      }
    ]
  },
  {
    path: '/login',
    component: login
  },
  {
    path: '*',
    component: NotFound
  }
]

const router = new VueRouter({
  routes
})

export default router
